package service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dao.AreaTop3Dao;
import dao.impl.AreaTop3DaoImpl;
import domain.AreaTop3;

import java.util.List;

public class AreaTop3Service {
    String valueAsString = null;
    private AreaTop3Dao contacts = new AreaTop3DaoImpl();
    public String ToJson() {
        List<AreaTop3> list = contacts.SelectVisit();
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            valueAsString = objectMapper.writeValueAsString(list);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return valueAsString;
    }
}
